package SellCar.service.impl;

import java.util.List;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import SellCar.dao.user.impl.UserMapperImpl;
import SellCar.pojo.User;
import SellCar.service.UserBiz;
//业务层实现类
@Service("userBiz")
public class UserBizImpl implements UserBiz{
	@Autowired
	@Qualifier("userMapperImpl")
	private UserMapperImpl userMapper;
	
	//通过账户名和密码来获取集合
	public List<User> getUserListByUserName(String userName, String password) {
		return userMapper.getUserListByUserName(userName, password);
	}

	//判断拿到的用户名和密码匹配
	public boolean panduan(String userName, String password) {
		boolean flag = true;
		if(this.getUserListByUserName(userName, password).size()>0){
			flag = true;
		}else{
			flag = false;
		}
		return flag;
	}
	
	//新增用户的实现方法
	public int addUser(String userName, String password,Integer idCardno) {
		return userMapper.addUser(userName, password, idCardno);
	}
	
	//注册效验
	public boolean panduan1(String userName, String password,Integer idCardno) {
		if(this.addUser(userName, password, idCardno)>0 && this.getUserListByUserName(userName, password).size()<0){
			return true;
		}else{
			return false;
		}
		
	}

	


}
